package com.testAll;

import com.core.jdbc.SqlHelper;

import java.io.File;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;

public class poiTest {
    public static void main(String[] args) {

        long start = new Date().getTime();
        parsePath();
        System.out.println((new Date().getTime() - start) / 1000 + "ms");
    }

    public static void parsePath() {
        try {
            File file = new File("E:\\金雅2\\运营系统教案\\0-1岁");
            if (file.isDirectory()) {
                for (File f : file.listFiles()) {
                    if (!f.isDirectory() && !f.getName().startsWith("~")) {
                        System.out.println(f.getPath());

                    }
                }
                List<String> all = new LinkedList<>();
                String filter="0-1.xlsx";
                String[] fs=filter.split(",");


                for (File f : file.listFiles()) {
                    boolean is=isCon(f.getName(),fs);

                    if (!f.isDirectory() && !f.getName().startsWith("~")&&is) {

                        List<String> son = poiTest2.parseExcel(f.getPath());
                        all.addAll(son);
                    }
                }

                System.out.println(all.size());
                SqlHelper.sqlOperateList(all);
            }

        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    private static boolean isCon(String f,String[] fs) {
        boolean is=false;
        for(String ff:fs){
            if(f.equals(ff)){
                is=true;
                break;
            }
        }
        return is;
    }

    public static void add() {

    }


}
